/* Copyright (C) 2011. ChengDu Unicon system, All Rights Reserved */

/*""FILE COMMENT""******************************* Technical reference data ****
* File Name	: crank.h
* Version 	: 1.00
* Device 	: SH72543
* Tool Chain 	: 
* H/W Platform	: 
* Description 	: 
******************************************************************************/

/******************************************************************************
* History 	: 09.08.2011 Ver. 1.00 First Release
*		: 
*FILE COMMENT END*********************************************************/

#define LOAD_REGISTER_B   0  //Load register B
#define OCRB1_VALUE       3  //Output Compare register B1
#define PIMR_VALUE        60 //Pulse interval multiplier register
#define OCRB6_VALUE       0xFFFFF //Output Compare Register B6
#define OCRB7_VALUE       0xFFFFF //Output Compare Register B7
#define TCCLRB_VALUE      1  //Correcting Counter Clearing Register B

/* Define Crank Hardware Register Config Struct */
typedef struct
{
  CPU_INT08U edgeType    :2;   //Crank edge capture, 00 disable, 01 rising, 10 falling, 11 both edge
  CPU_INT08U hardWareCfg :2;  //Crank input hardware config
  CPU_INT08U             :4;
  CPU_INT08U minPW;         //Crank input min pulse width, The unit is uS
  CPU_INT16U magTrigMin;    //Crank input mag min trigger level
  CPU_INT16U magTrigOutMax; //Crank input mag max trigger output
  CPU_INT16U pwmCycle; //Hz
  CPU_INT16U pwmDuty;  //0~10000(0.00%~100.00%)
}ST_CRANK_HW_SET;

void CrankInit( const ST_CRANK_HW_SET *const crankHWInt );